Skip to contentSkip to conversation

Change in openvpn[master]: configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Sep 22, 2025 – Sep 23, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1758544032000.I1ce408d4473874d88a348308503527ef7eb8c1ff@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1204?usp=email

to review the following change.

Change subject: configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend
......................................................................

configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend

The prepend behavior is surprising. If there is a difference in behavior at least make it easy to understand what happens why.

Change-Id I1ce408d4473874d88a348308503527ef7eb8c1ff

---
M configure.ac

1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/04/1204/1

configure.ac +2 -2
index 03c5e3b..acda253 100644
@@ -1387,9 +1387,9 @@
 # required for gcc, but some compilers such as clang need it.
 AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [
     old_cflags="$CFLAGS"
-    CFLAGS="$1 -Werror $CFLAGS"
+    CFLAGS="-Werror $CFLAGS $1"
     AC_MSG_CHECKING([whether the compiler accepts $1])
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$1 $old_cflags",
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$old_cflags $1",
         [AC_MSG_RESULT([no]); CFLAGS="$old_cflags"])]
 )
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1204?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1ce408d4473874d88a348308503527ef7eb8c1ff
Gerrit-Change-Number: 1204
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1204?usp=email )

Change subject: configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend
......................................................................

Patch Set 2: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1204?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1ce408d4473874d88a348308503527ef7eb8c1ff
Gerrit-Change-Number: 1204
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 23 Sep 2025 12:19:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH v2 1/1 configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

The prepend behavior is surprising. If there is a difference in behavior at least make it easy to understand what happens why.

Change-Id I1ce408d4473874d88a348308503527ef7eb8c1ff

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1204
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1204
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

configure.ac +2 -2
index a5485b0..c2feeea 100644
@@ -1388,9 +1388,9 @@
 # required for gcc, but some compilers such as clang need it.
 AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [
     old_cflags="$CFLAGS"
-    CFLAGS="$1 -Werror $CFLAGS"
+    CFLAGS="-Werror $CFLAGS $1"
     AC_MSG_CHECKING([whether the compiler accepts $1])
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$1 $old_cflags",
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$old_cflags $1",
         [AC_MSG_RESULT([no]); CFLAGS="$old_cflags"])]
 )
 
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend

So, as discussed on IRC, this is not really intended to "change anything noticeable" - but when working on adding CFLAGS and generally autoconf related, it helps when "add this to CFLAGS" does not "it will show up in front" (because your mental model expects this "at the end").

Tested, -W arguments and -g/-O2/-std=c11 are in reverse order, everything else is the same.

Your patch has been applied to the master branch.

commit 9bfd4d246c50743c8ff9cdb72afc8741eab91f03

Author: Frank Lichtenheld
Date:   Tue Sep 23 14:20:00 2025 +0200
     configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1204
     Message-Id: <[email protected]...>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59237450/
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#3) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1204?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend
......................................................................

configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend

The prepend behavior is surprising. If there is a difference in behavior at least make it easy to understand what happens why.

Change-Id I1ce408d4473874d88a348308503527ef7eb8c1ff

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1204
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237450/

---
M configure.ac

1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/04/1204/3

configure.ac +2 -2
index 38b14a1..0fc21ee 100644
@@ -1388,9 +1388,9 @@
 # required for gcc, but some compilers such as clang need it.
 AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [
     old_cflags="$CFLAGS"
-    CFLAGS="$1 -Werror $CFLAGS"
+    CFLAGS="-Werror $CFLAGS $1"
     AC_MSG_CHECKING([whether the compiler accepts $1])
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$1 $old_cflags",
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$old_cflags $1",
         [AC_MSG_RESULT([no]); CFLAGS="$old_cflags"])]
 )
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1204?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1ce408d4473874d88a348308503527ef7eb8c1ff
Gerrit-Change-Number: 1204
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1204?usp=email )

Change subject: configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend
......................................................................

configure.ac: Make ACL_CHECK_ADD_COMPILE_FLAGS append instead of prepend

The prepend behavior is surprising. If there is a difference in behavior at least make it easy to understand what happens why.

Change-Id I1ce408d4473874d88a348308503527ef7eb8c1ff

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1204
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237450/

---
M configure.ac

1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +2 -2
index 38b14a1..0fc21ee 100644
@@ -1388,9 +1388,9 @@
 # required for gcc, but some compilers such as clang need it.
 AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [
     old_cflags="$CFLAGS"
-    CFLAGS="$1 -Werror $CFLAGS"
+    CFLAGS="-Werror $CFLAGS $1"
     AC_MSG_CHECKING([whether the compiler accepts $1])
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$1 $old_cflags",
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$old_cflags $1",
         [AC_MSG_RESULT([no]); CFLAGS="$old_cflags"])]
 )
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1204?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1ce408d4473874d88a348308503527ef7eb8c1ff
Gerrit-Change-Number: 1204
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged